/* Copyright (C) 2010 Fredrique Samuels, fredriquesamuels@gmail.com */

/*
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <assert.h>
#include <stdlib.h>

#include "context.h"


namespace tri
{

TContext::TContext(){
	this->_last_mouse_position[0] = -1;
	this->_last_mouse_position[1] = -1;
	this->_last_button_pressed = NONE;
};

TContext::~TContext(){};

void TContext::setLastMousePosition(int x,int y){
	this->_last_mouse_position[0] = x;
	this->_last_mouse_position[1] = y;
}
void TContext::setLastButtonPressed(int b){
	this->_last_button_pressed = b;
}

void TContext::getLastMousePosition(int& x,int& y){
	x = this->_last_mouse_position[0];
	y = this->_last_mouse_position[1];
}

int TContext::getLastButtonPressed(){
	return this->_last_button_pressed;
}

TWindow::TWindow():_context(NULL){}
TWindow::~TWindow(){
	_context = NULL;
}

void TWindow::run(int width,int height,std::string caption,bool fullscreen){
	start(width,height,caption,fullscreen);
}

void TWindow::setContext(TContext* c){
	assert(_context == NULL);
	_context = c;
}

}
